using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DeckCardsUI : UIBase
{
    private Transform cardsContainer;

    private Button button;

    private void Start()
    {
        cardsContainer = transform.Find("Scroll View/Viewport/Content");

        button = transform.Find("Button").GetComponent<Button>();

        button.onClick.AddListener(Close);

        for (int i = 0; i < FightCardManager.Instance.deckList.Count; i++)
        {
            GameObject obj = Instantiate(Resources.Load("UI/ShowCardItem"), transform) as GameObject;
            string cardId = FightCardManager.Instance.deckList[i];
            Dictionary<string, string> data = GameConfigManager.Instance.GetCardById(cardId);
            ShowCard item = obj.AddComponent<ShowCard>();
            item.Init(data);
            obj.transform.SetParent(cardsContainer);
        }
    }
}
